package nc;


import java.util.Scanner;
import java.util.TreeMap;

public class Q21325 {

    public static String resort(String content) {
        // 去重然后排序
        TreeMap<Character, Integer> count = new TreeMap<>();
        for (int i = 0; i < content.length(); i++) {
            final char c = content.charAt(i);
            if ((c >='a' && c <='z') ||
                    (c >='A' && c <= 'Z') ||
                    (c == ' ')||
                    (c >='0' && c<='9')
            ) {
                Integer integer = count.get(c);
                if (integer == null) {
                    integer = 0;
                }
                integer ++;
                count.put(c, integer);
            }
        }
        TreeMap<Integer, StringBuilder> contents = new TreeMap<>();
        for (Character c : count.keySet()) {
            // 由于从大到小，这里取相反数
            StringBuilder builder = contents.get(-count.get(c));
            if (builder == null) {
                builder = new StringBuilder();
                contents.put(-count.get(c), builder);
            }
            builder.append(c);
        }
        StringBuilder sb = new StringBuilder();
        for (Integer integer : contents.keySet()) {
            final StringBuilder next = contents.get(integer);
            sb.append(next.toString());
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            final String s = scanner.nextLine();
            System.out.println(resort(s));
        }
    }

}
